package com.csu.service;

import com.csu.mapper.AccountMapper;
import com.csu.model.Account;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("accountService")
@MapperScan("com.csu.mapper")
public class AccountService {
    @Autowired
    private AccountMapper accountDao;

    public Account getAccount(String username) {
        return accountDao.getAccountByUsername(username);
    }

    public Account getAccount(String username, String password) {
        Account account = new Account();
        account.setUsername(username);
        account.setPassword(password);
        return accountDao.getAccountByUsernameAndPassword(account);
    }

//    public void insertAccount(Account account) {
//        accountDao.insertAccount(account);
//        accountDao.insertSignon(account);
//        accountDao.insertProfile(account);
//    }
//
//
//    public void updateAccount(Account account) {
//        accountDao.updateAccount(account);
//        accountDao.updateProfile(account);
//
//        if (account.getPassword() != null && account.getPassword().length() > 0) {
//            accountDao.updateSignon(account);
//        }
//    }

}
